<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue_v-bind</title>
    <style>
        .active{
            border: 1px solid red;
        }
    </style>
</head>
<body>
    <div id="app">
      <!-- <img src="monkey.gif">-->
      <img v-bind:src="imgSrc" alt="">
      <br> 
      <!--下种方式更为常用-->
      <img :src="imgSrc" alt="" :title="imgTitle+'！！！'" :class="isActive?'active':''"
       @click="toggleActive">
       <br> 
      <!--两种方式：
      三元表达式：<img v-bind:class="isActive?'active':''">
      对象形式：<img v-bind:class="{active:isActive}">-->
    </div>
    <!-- 开发环境版本，包含了有帮助的命令行警告 -->
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.14/dist/vue.js"></script>
    <script>
        var app = new Vue({
            el:"#app", 
            data:{
               imgSrc:"monkey.gif",
               imgTitle:"程序猿",
               isActive:false
            },
            methods:{
                toggleActive:function(){
                    this.isActive = !this.isActive;
                }
            }
        })
    </script>
</body>
</html>
